package com.weilan.blog.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.weilan.blog.admin.entity.SysConfig;
import com.weilan.blog.admin.mapper.SysConfigMapper;
import com.weilan.blog.admin.service.SysConfigService;
import com.weilan.blog.admin.vo.SysConfigVO;
import com.weilan.blog.base.enums.EStatus;
import com.weilan.blog.base.serviceImpl.SuperServiceImpl;
import com.weilan.blog.common.global.SQLConf;
import com.weilan.blog.common.global.SysConf;

import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @description:
 * @author: 孙 峰
 * @time: 2020/9/23 23:05
 */
@Service
public class SysConfigServiceImpl extends SuperServiceImpl<SysConfigMapper, SysConfig> implements SysConfigService {

    @Override
    public SysConfig getConfig() {
        QueryWrapper<SysConfig> queryWrapper = new QueryWrapper<>();
        queryWrapper.orderByDesc(SQLConf.CREATE_TIME);
        queryWrapper.eq(SQLConf.STATUS, EStatus.ENABLE);
        queryWrapper.last(SysConf.LIMIT_ONE);

        return    getOne(queryWrapper);
    }

    @Override
    public String cleanRedisByKey(List<String> key) {
        return null;
    }

    @Override
    public String editSystemConfig(SysConfigVO sysConfigVO) {
        return null;
    }
}
